package com.csun.dsms.service;

import com.csun.dsms.comment.core.support.IService;
import com.csun.dsms.model.domain.DsmsMenu;
import com.csun.dsms.model.domain.DsmsUser;
import com.csun.dsms.model.dto.menu.*;
import com.csun.dsms.model.vo.menu.BindAuthVo;
import com.csun.dsms.model.vo.menu.MenuVo;
import com.csun.dsms.model.vo.menu.ViewMenuVo;

import java.util.List;

/**
 * @author chisj chisj@foxmail.com
 * @version 1.0.0
 * @date 2021-09-01 11:55
 * @description: TODO
 */
public interface DsmsMenuService extends IService<DsmsMenu> {

    /**
     * 检测菜单编码是否已存在
     *
     * @param menuCheckCodeDto  the menu check code dto
     *
     * @return  true-the menu code is not exist.
     */
    boolean checkMenuCode(MenuCheckCodeDto menuCheckCodeDto);

    /**
     * 检测菜单名称唯一性
     *
     * @param menuCheckNameDto  the menu check name dto
     *
     * @return  true-the menu name is not exist.
     */
    boolean checkMenuName(MenuCheckNameDto menuCheckNameDto);

    /**
     * 检测菜单URL唯一性
     *
     * @param menuCheckUrlDto   the menu check url dto
     *
     * @return  true-the menu url is not exist.
     */
    boolean checkMenuUrl(MenuCheckUrlDto menuCheckUrlDto);

    /**
     * 获取菜单列表数据
     *
     * @return
     */
    List<MenuVo> getMenuVoList();

    /**
     * 查询菜单详情
     *
     * @param id    the menu id
     *
     * @return  the view menu vo.
     */
    ViewMenuVo getViewVoById(Long id);

    /**
     * 查询菜单及下面所有子菜单
     *
     * @param menuQueryDto  the menu query dto
     *
     * @return  the dsms menu
     */
    List<DsmsMenu> queryMenuAndSubMenuListWithPage(MenuQueryDto menuQueryDto);

    /**
     * 根据id修改菜单的禁用状态
     *
     * @param menuStatusDto the menu status dto
     * @param login the login user
     *
     * @return  the int.
     */
    Integer updateMenuStatusById(MenuStatusDto menuStatusDto, DsmsUser login);

    /**
     * 新增菜单
     *
     * @param dsmsMenu  the dsms menu
     * @param login the login user
     *
     * @return  the int.
     */
    Integer save(DsmsMenu dsmsMenu, DsmsUser login);

    /**
     * 修改菜单信息
     *
     * @param dsmsMenu  the dsms menu
     * @param login the login user
     *
     * @return  the int.
     */
    Integer editMenu(DsmsMenu dsmsMenu, DsmsUser login);

    /**
     * 判断此菜单是否有子节点
     *
     * @param pid    the parent id
     *
     * @return  the boolean
     */
    boolean checkMenuHasChildMenu(Long pid);

    /**
     * 根据id删除菜单
     *
     * @param id    the id
     * @param login the login user
     *
     * @return  the int.
     */
    Integer deleteMenuById(Long id, DsmsUser login);

    /**
     * Gets all child menu by menu id.
     *
     * @param id   the id
     * @param type the type
     *
     * @return the all child menu by menu id
     */
    List<DsmsMenu> getAllChildMenuByMenuId(Long id, String type);

    /**
     * Enable menu list int.
     *
     * @param menuList  the menu list
     * @param login     the login user
     *
     * @return the int
     */
    int enableMenuList(List<DsmsMenu> menuList, DsmsUser login);

    /**
     * Disable menu list int.
     *
     * @param menuList  the menu list
     * @param login     the login user
     *
     * @return the int
     */
    int disableMenuList(List<DsmsMenu> menuList, DsmsUser login);

    /**
     * Gets all parent menu by menu id.
     *
     * @param id the id
     *
     * @return the all parent menu by menu id
     */
    List<DsmsMenu> getAllParentMenuByMenuId(Long id);

    /**
     * Gets checked menu list.
     *
     * @param roleId the role id
     *
     * @return the checked menu list
     */
    List<Long> getCheckedMenuList(Long roleId);

    /**
     * 查询角色菜单列表
     *
     * @param menuQueryDto role menu query dto
     *
     * @return the page info.
     */
    List<DsmsMenu> queryRoleMenuListWithPage(MenuQueryDto menuQueryDto);

    /**
     * 根据菜单Id列表生成菜单树
     *
     * @param menuIdList	the menu id list
     *
     * @return	the bind auth vo
     */
    BindAuthVo getMenuTreeByMenuIdList(List<Long> menuIdList);

    /**
     * 查询菜单列表
     *
     * @param menuQueryDto	the menu query dto
     *
     * @return	the list.
     */
    List<DsmsMenu> queryMenuList(MenuQueryDto menuQueryDto);

    /**
     * 生成列表
     *
     * @param menuList  the menu list
     *
     * @return  the menu vo list.
     */
    List<MenuVo> getAuthList(List<DsmsMenu> menuList);
}
